package com.sugar.real.estate.module.business.controller.admin.info.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;

import static com.sugar.real.estate.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;

@Schema(description = "管理后台 - 资讯信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class InfoRespVO {

    @Schema(description = "资讯分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9307")
    @ExcelProperty("资讯分类ID")
    private Long id;

    @Schema(description = "所属分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27261")
    @ExcelProperty("所属分类ID")
    private Long clsId;

    @Schema(description = "所属分类名称（中文）", requiredMode = Schema.RequiredMode.REQUIRED, example = "27261")
    @ExcelProperty("所属分类名称（中文）")
    private String clsNameZhCn;

    @Schema(description = "所属分类名称（英文）", requiredMode = Schema.RequiredMode.REQUIRED, example = "27261")
    @ExcelProperty("所属分类名称（英文）")
    private String clsNameEnUs;

    @Schema(description = "封面图", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("封面图")
    private String banner;

    @Schema(description = "标题（中文）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("标题（中文）")
    private String titleZhCn;

    @Schema(description = "标题（英文）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("标题（英文）")
    private String titleEnUs;

    @Schema(description = "内容（中文）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("内容（中文）")
    private String contentZhCn;

    @Schema(description = "内容（英文）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("内容（英文）")
    private String contentEnUs;

    @Schema(description = "发布时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("发布时间")
    @JsonSerialize(using = LocalDateSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    private LocalDate releaseDate;

    @Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "8056")
    @ExcelProperty("浏览量")
    private Long viewCount;

    @Schema(description = "作者名（中文）")
    @ExcelProperty("作者名（中文）")
    private String authorZhCn;

    @Schema(description = "作者名（英文）")
    @ExcelProperty("作者名（英文）")
    private String authorEnUs;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @Schema(description = "是否热门（0否 1是）")
    private Boolean isHot;
}